define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		/**
         * 一键切换数据获取方式
         * @param {Object} result
         */
        function get_info_clickrate(result) {
            if (false) {
                result = '{"success":true,"msg":"","result":{"homepage_clickrate":100,"brand":[{"brand_id":"001","name":"这是品牌的名称","image":"img/upload/pro-img01.jpg","rate":70},{"brand_id":"002","name":"这是品牌的名称","image":"img/upload/pro-img01.jpg","rate":80}],"goods":[{"goods_id":"001","name":"这是商品的名称","image":"img/upload/pro-img01.jpg","rate":66},{"goods_id":"002","name":"这是商品的名称","image":"img/upload/pro-img01.jpg","rate":99}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            }
            else {
                return result;
            }
        }
		
		//返回信息
		return {
			get_detail: function(callback) {
				Http.post({
                    method: 'info.clickrate'
                }, function (result) {
                    //请求成功
                    if (callback) {
                        callback(get_info_clickrate(result).result);
                    }
                }, function (e) {
                    //请求异常
                }, function () {
                    //请求完成，一般不做什么事情
                });
			}
			
			
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Previewamount", factory);
});